#include "Quad.h"
#include "glad\glad.h"
#include <algorithm>
namespace ShaderLab {
	Quad::Quad(float _size = 1.0f)
	{
		// clamp size in 0 - 1
		if (_size > 1.0f) {
			_size = 1.0f;
		}
		else if(_size < 0.0f){
			_size = 0.0f;
		}
		std::vector<GLfloat> vertices = {
			-_size, -_size, 0.0f,//0
			 _size, -_size, 0.0f,//1
			-_size,  _size, 0.0f,//2
			 _size,  _size, 0.0f //3
		};
		std::vector<GLuint> indices = {
			0,1,3,0,3,2
		};
		std::vector<GLfloat> normals(vertices.size(), 0.0f);
		std::vector<GLfloat> texCoords = {
			0.0f,0.0f,
			1.0f,0.0f,
			0.0f,1.0f,
			1.0f,1.0f
		};
		TriangleMesh::initBuffers(&indices, &vertices, &normals, &texCoords);
	}
}